package com.bupt.server.entity;

public class Record {
    public int room_id;
    public String request_time;
    public String start_time;
    public String end_time;

    public String speed;
    public String server_start_time;
    public String server_end_time;
    public int server_time;
    public float cost_rate;
    public float cur_cost;

    public Record(int room_id, String start_time, String end_time, String speed, int server_time) {
        this.room_id = room_id;
        this.request_time = "request_time: UnKnown";
        this.start_time = start_time;
        this.end_time = end_time;
        this.speed = speed;
        this.server_start_time = "server_start_time: UnKnown";
        this.server_end_time = "server_end_time: UnKnown";
        this.server_time = server_time;
        this.cost_rate = getCostRateBySpeed();
        this.cur_cost = server_time * getCostRateBySpeed();
    }
    private Float getCostRateBySpeed() {
        switch (speed) {
            case "high":
                return 1.0f;
            case "medium":
                return 0.5f;
            case "low":
                return 0.33f;
        }
        return 0f;
    }
    public void printRecord() {
        System.out.println("==========");
        System.out.println("房间号: " + room_id);
        System.out.println("风速: " + speed);
        System.out.println("该风速下的费率:" + cost_rate);
        System.out.println("该风速下开始服务时间: " + start_time);
        System.out.println("该风速下结束服务时间:" + end_time);
        System.out.println("该风速下总计服务时间:" + server_time);
        System.out.println("这一段服务的消费:" + cur_cost);
        System.out.println("==========");
    }

}
